﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.ObjectExtensions;
using CommonExtensions.StringExtensions;
using DBMigrator.Core.DbObjects.Data.Where;
using StructureMap;

namespace DBMigrator.Core.DbObjects.Data.Delete
{
    public class DeleteFromOptions : IDeleteFromOptions
    {
        public Type SqlGenerationType
        {
            get { return typeof (IDeleteFromOptions); }
        }

        public string TableName { get; private set; }
        public IBeginWhere BeginWhere { get; private set; }
        
        public DeleteFromOptions(IBeginWhere beginWhere)
        {
            if(beginWhere.IsNull())
                throw new ArgumentNullException("beginWhere");

            BeginWhere = beginWhere;
        }

        public IBeginWhere Table(string tableName)
        {
            if(tableName.IsBlank())
                throw new ArgumentNullException("tableName");

            TableName = tableName;
            
            return BeginWhere;
        }
    }
}
